/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package graphic;

import java.awt.Color;
import java.awt.Frame;
import java.awt.Graphics;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
//import javax.swing.JTextField;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
//import javax.swing.JFrame;

/**
 *
 * @author sylvain
 */

class Repeindre extends Frame {
    private Closer Handler;

    public Repeindre() {
        setTitle("Repeindre");

        Handler = new Closer ();
        addMouseListener((MouseListener) new Reveleur());
        addWindowListener(Handler);

        setSize(300,300);
        setLocationRelativeTo(null);
        setResizable(false);
        //setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setVisible(true);
        Graphics g = getGraphics();
        g.setColor(Color.blue);
        g.fillRect(0, 0, getSize().width, getSize().height);
        g.dispose();
        //JTextField text = new JTextField() ;
    }

    class Reveleur extends MouseAdapter {
        @Override
        public void mousePressed(MouseEvent e) {
            repaint(e.getX()-10, e.getY()-10, 20, 20);
        }
    }

    class Closer extends WindowAdapter {
        public void windowClosing (WindowEvent event) {
            System.exit (0);
        }
    }

    public static void main(String[] args) {
        new Repeindre();
    }
}
